#include <stdio.h>
#include <string.h>

struct student {
	char number[100];
	char name[100];
	int math, eng, cx, phy;
} a[100], b;

int main(void) {
	int n;
	int sum = 0;
	scanf("%d", &n);
	for (int j = 0; j < n; j++) {
		scanf("%s %s %d %d %d %d", &a[j].number, &a[j].name, &a[j].math, &a[j].eng, &a[j].cx, &a[j].phy);
	}
	scanf("%s", &b.name);
	for (int i = 0; i < n; i++) {
		if (strcmp(a[i].name, b.name) == 0) {
			printf("%s %s %d %d %d %d", a[i].number, a[i].name, a[i].math, a[i].eng, a[i].cx, a[i].phy);
			sum = 1;
		}
	}
	if (sum == 0)
		printf("Not Found!");
}